主题
通过DMA读取指定地址的双精度浮点数 - DmaReadDouble
函数简介
通过 DMA 读取指定地址的双精度浮点数,支持 CE 地址格式。(高级版功能,普通版无法使用)
接口名称
DmaReadDoubleDLL调用
c
double OLA_CALL_TYPE DmaReadDouble(int64_t instance, int64_t deviceId, int32_t pid, OLA_STRING_INPUT addr);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| deviceId | 长整数型 | 设备ID |
| pid | 整数型 | 进程 PID |
| addr | 字符串 | 地址,支持 CE 数据格式 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
long deviceId = ola.DmaAddDevice(1);
double value = ola.DmaReadDouble(deviceId, 1234, "0x401000");csharp
using OLAPlug;
var ola = new OLAPlugServer();
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
long deviceId = ola.DmaAddDevice(1);
double value = ola.DmaReadDouble(deviceId, 1234, "0x401000");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
# 先添加 DMA 设备,返回的 deviceId 用于后续读写
deviceId = ola.DmaAddDevice(1)
value = ola.DmaReadDouble(deviceId, 1234, "0x401000")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
long deviceId = ola.DmaAddDevice(1);
double value = ola.DmaReadDouble(deviceId, 1234, "0x401000");cpp
var ola = com("OlaPlug.OlaSoft")
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
var deviceId = ola.DmaAddDevice(1)
var value = ola.DmaReadDouble(deviceId, 1234, "0x401000")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' 先添加 DMA 设备,返回的 deviceId 用于后续读写
deviceId = ola.DmaAddDevice(1)
value = ola.DmaReadDouble(deviceId, 1234, "0x401000")text
.局部变量 ola, OLAPlug
ola.创建 ()
' 先添加 DMA 设备,返回的 deviceId 用于后续读写
deviceId = ola.DmaAddDevice(1)
value = ola.DmaReadDouble(deviceId, 1234, “0x401000“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
var deviceId = ola.DmaAddDevice(1);
var value = ola.DmaReadDouble(deviceId, 1234, "0x401000");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
长整数 deviceId = ola.DmaAddDevice(1)
double value = ola.DmaReadDouble(deviceId, 1234, "0x401000")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// 先添加 DMA 设备,返回的 deviceId 用于后续读写
long deviceId = ola.DmaAddDevice(1);
double value = ola.DmaReadDouble(deviceId, 1234, "0x401000");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);
DmaReadDouble(instance, deviceId, 1234, "0x401000");csharp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);
DmaReadDouble(instance, deviceId, 1234, "0x401000");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
deviceId = DmaAddDevice(instance, 1)
DmaReadDouble(instance, deviceId, 1234, "0x401000")返回值
双精度浮点数:返回读取到的双精度浮点数值。
